package com.leetcode.common.utils;

import java.util.concurrent.ThreadLocalRandom;

/**
 * @author 覃国强
 * @date 2022-03-02 22:05
 */
public class ArrayUtils {

  public static int[] randomArr(int length) {
    int[] arr = new int[length];
    for (int i = 0; i < length; ++i) {
      arr[i] = ThreadLocalRandom.current().nextInt(0, 100);
    }
    return arr;
  }

  public static void print2dArray(int[][] arr) {
    if (arr == null || arr.length == 0) {
      return;
    }
    for (int i = 0; i < arr.length; ++i) {
      for (int j = 0; j < arr[i].length; ++j) {
        System.out.print(arr[i][j] + "\t\t\t");
      }
      System.out.println();
    }
  }

}
